﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BacteriaSimulation.Simulation
{
    public class ForceField
    {
        protected double expirePeriod;
        protected double time;

        public double ExpirePeriod
        {
            get { return expirePeriod; }
            set { expirePeriod = value; }
        }

        public void IncreseTime(double timeIncrement)
        {
            this.time += timeIncrement;
        }

        public Vector2D GetAppliedField(SimulationPoint applicationPoint)
        {
            SimulationPoint repulsionCenter = new SimulationPoint(200, 200);
            double distance = SimulationPoint.Distance(applicationPoint, repulsionCenter);
            double forceMagnitude = 300000 / (distance * distance);
            UnitVector2D unityVector = new UnitVector2D(repulsionCenter.X - applicationPoint.X, repulsionCenter.Y - applicationPoint.Y);
            Vector2D forceVector = new Vector2D(forceMagnitude * unityVector.XComponent, forceMagnitude * unityVector.YComponent);

            return forceVector;
        }
    }
}
